// pages/order/index.js
import {axios} from '../../request'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    menuList:[
      {
        title:"全部",
        id:1,
      },
      {
        title:"待付款",
        id:2,
      },
      {
        title:"待发货",
        id:3,
      },
    ],
    ordersList:[]
  },
  navItemClick(e){
    const {id,index} = e.detail
    this.getOrderAll(id)
  },
  getOrderAll(type){
    axios({
      url:'/my/orders/all',
      data:{
        type
      }
    }).then(res=>{
      const {orders} = res.message
      console.log('orders: ', orders);
      this.setData({
        ordersList:orders
      })
    })
  },
  onShow(){
    this.getOrderAll(1)  
  }
})